<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:t="http://myfaces.apache.org/tomahawk" xml:lang="en" lang="en">
<body>
<h:form id="uploadForm2" enctype="multipart/form-data">

        <h:panelGroup rendered="#{edit.uploaded==false}">
            <t:inputFileUpload id="fileUpload" value="#{edit.uploadedFile}"/>
            <h:commandButton value="#{editloc.toload}" action="#{edit.uploadFile}">
            </h:commandButton>
        </h:panelGroup>
    </h:form>
<h:form>
    <h:panelGrid columns="1">
        <h:panelGroup rendered="#{edit.uploaded==true}">
            <h:graphicImage value="/image?#{edit.parametrUrl}=#{edit.dataPosition.image}" />
            <h:commandLink value="#{editloc.changepic}" action="#{edit.changePic}" immediate="true"/>
        </h:panelGroup>
        <h:outputText value="#{editloc.name}"/>
        <h:inputText value="#{edit.dataPosition.name}"  id="editname" required="true" requiredMessage="#{validationmessages.namealert}"/>
        <h:outputText value="#{editloc.category}" />
        <h:inputText value="#{edit.dataPosition.categoryName}"  id="editCat" required="true" requiredMessage="#{validationmessages.categoryalert}"/>
        <h:outputText value="#{editloc.content}"/>
        <h:inputText value="#{edit.dataPosition.textContent}" id="editCon" required="true" requiredMessage="#{validationmessages.contentalert}"/>
        <h:outputText value="#{editloc.price}"/>
        <h:inputText value="#{edit.dataPosition.price}" id="editprice"  required="true" requiredMessage="#{validationmessages.variablealert}" validator="uplodoadedfilevalidatoredit"/>
        <h:panelGroup>
            <h:commandButton value="#{editloc.save}" action="#{edit.saveElementInBD}"/>
            <h:commandButton value="#{editloc.back}" action="#{edit.backToMain}" immediate="true"/>
        </h:panelGroup>
    </h:panelGrid>
    <h:panelGrid columns="1">
        <h:message for="editprice" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
        <h:message for="editCat" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
        <h:message for="editCon" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
        <h:message for="editname" showSummary="false" showDetail="true" errorStyle="color:#ff0000"/>
    </h:panelGrid>
</h:form>
</body>
</html>